<?PHP
require_once('classes/classComentarios.php');
require_once('classes/classUtils.php');

$comments = new Comentarios();
$utils = new Utils();

if(isset($_GET["nid"])){
    $comments->delComentario($_GET["nid"]);
}

$arrComments = $comments->getTop20();

$sRows ='';
?>
<form action="" method="post" name="frmDelNotas">
    <table width="100%" border="1" cellspacing="2" cellpadding="4">
        <tr class="tablaEditor">
            <td>&nbsp;</td>
            <td>Nombre</td>
            <td>Email</td>
            <td>Commentario</td>
            <td>Fecha</td>
        </tr>
        <?PHP
        for($i=0; $i<sizeof($arrComments); $i++){

            if($i%2==0){
                $sRows .= "<tr class='evenRow'>";
            }
            else{
                $sRows .= "<tr class='oddRow'>";
            }

            $fecha = date('d/m/Y', strtotime($arrComments[$i]["fechaCreado"]));

            $sRows .= "<td><a href=\"Editor.php?AX=3&BX=23&nid="
                .$arrComments[$i]["comentid"]."\">Borrar</a></td>
		    <td>".$arrComments[$i]["user"]."</td>
		    <td>".$arrComments[$i]["email"]."</td>
		    <td>".$arrComments[$i]["comentario"]."</td>
		    <td>".$fecha."</td>
		  </tr>";
        }

        echo $sRows;
        ?>
        <tr>
            <td colspan="4">&nbsp;</td>
        </tr>
    </table>
</form>